import java.util.Arrays;
import java.util.Scanner;

public class QuickSort {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }
        quickSort(arr, 0, arr.length - 1);
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    public static void quickSort(int[] arr, int left, int right) {
        if (left >= right) {
            return;
        }

        //基准数是拿的最左边的数
        int l = left;
        int r = right;

        //获取基准数
        int temp = arr[left];


        while (l != r) {
            //找到右边比基准数小的索引
            while (temp <= arr[r] && l < r) {
                r--;
            }
            //找到左边区域比基准数大的索引
            while (temp >= arr[l] && l < r) {
                l++;
            }

            //如果扫描的没有重合就移位
            if (l < r) {
                int s = arr[l];
                arr[l] = arr[r];
                arr[r] = s;
            }
        }
        //基准数归位
        arr[left] = arr[l];
        arr[l] = temp;
//        System.out.println("temp=" + temp + Arrays.toString(arr));
        quickSort(arr, left, l - 1);
        quickSort(arr, l + 1, right);

    }
}
